<?php

class MemberMapAction extends MemberBaseAction {

    public function index() {
        $location = $this->getLocation();

        $member = D("Member")->getByid($_SESSION[C('USER_AUTH_KEY')]);
        $lat = empty($member['latitude']) ? $location['latitude'] : $member['latitude'];
        $lng = empty($member['longitude']) ? $location['longitude'] : $member['longitude'];

        $this->assign($member);
        $this->assign('lat', $lat);
        $this->assign('lng', $lng);
        $this->display();
    }

    public function doedit() {
        $Member = M("Member");
        $Member->id = $_SESSION[C('USER_AUTH_KEY')];
        $Member->latitude = $_COOKIE['lat'];
        $Member->longitude = $_COOKIE['lng'];
        $Member->save();
        $this->assign("jumpUrl", "__URL__");
        $this->success("添加成功！");
    }

}

?>